package com.oocl.euc.core.maintenance.controller;

import com.oocl.euc.core.maintenance.model.ApplicationKey;
import com.oocl.euc.core.maintenance.service.ApplicationKeyService;
import com.oocl.euc.framework.base.controller.RESTController;
import com.oocl.euc.framework.base.service.BaseService;
import com.oocl.euc.framework.common.utils.ResponseEntityUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/rest/appKey")
public class ApplicationKeyController extends RESTController<ApplicationKey, Long> {

    @Autowired
    private ApplicationKeyService applicationKeyService;

    @Override
    protected BaseService<ApplicationKey, Long> getBaseService() {
        return applicationKeyService;
    }


    @RequestMapping(value = "/findByAppKey", method = RequestMethod.GET)
    public ResponseEntity getApplicationKey(@RequestParam("appKey") String appKey) {
        return ResponseEntityUtil.successInRestful(applicationKeyService.findByAppKey(appKey));
    }
}
